﻿using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FileIndexer
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("[START]");

            // DO SOMETHING
             DoWork();

            Console.WriteLine("[END]");
            Console.ReadLine();
        }


        public static void DoWork()
        {
            // To directly connect to a single MongoDB server
            // (this will not auto-discover the primary even if it's a member of a replica set)
            //var client = new MongoClient();

            // or use a connection string
            var client = new MongoClient("mongodb://localhost:27017");

            // or, to connect to a replica set, with auto-discovery of the primary, supply a seed list of members
            //var client = new MongoClient("mongodb://localhost:27017,localhost:27018,localhost:27019");
            var db = client.GetDatabase("test");

            var collection = db.GetCollection<BsonDocument>("bar");


            var doc = new BsonDocument
{
    { "name", "MongoDB" },
    { "type", "Database" },
    { "count", 1 },
    { "info", new BsonDocument
              {
                  { "x", 203 },
                  { "y", 102 }
              }}
};

            collection.InsertOneAsync(doc);



        } // public static void DoWork()

    }
}
